package spark.network.strategy;

import spark.network.protocol.Base;
import spark.network.protocol.Response;
import spark.utility.OutWrapper;

import java.util.Collection;

/**
 * Strategy interface for handling packets.
 * @param <PacketType> Packet providing the information needed to handle it.
 */
public interface IProtocolHandleStrategy<PacketType extends Base> {
	/**
	 * Handles a packet of type PacketType
	 * @param packet            packet to handle
	 * @param acknowledgement   out parameter to send an ack for reliable packets (null if PacketType is unreliable)
	 * @param additionalData    any packets put into this collection will be sent to the other end as well
	 */
	public void handle(PacketType packet, OutWrapper<Response> acknowledgement, Collection<Base> additionalData);
}
